﻿Imports System.Data.OleDb
Imports DTO
Public Class BangCapDAO
    Public Function laybangcap() As List(Of BangCapDTO)
        Dim sql = "select MaBangCap,TenBangCap from BangCap"
        Dim con As OleDbConnection = DatabaseProvider.connectData()
        Dim cmd As New OleDbCommand(sql, con)
        Dim reader As OleDbDataReader = cmd.ExecuteReader()
        Dim danhsach As New List(Of BangCapDTO)
        While reader.Read()
            Dim bcDTO As New BangCapDTO()
            bcDTO.MaBangCap = reader("MaBangCap")
            bcDTO.TenBangCap = reader("TenBangCap")
            danhsach.Add(bcDTO)
        End While

        con.Close()
        Return danhsach
    End Function
End Class
